package com.bit.aop.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class JDKInvocation implements InvocationHandler {
    private Object target;  //目标对象

    public JDKInvocation(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("我是中介, 开始代理");
        Object result = method.invoke(target, args);
        System.out.println("我是中介, 结束代理");
        return result;
    }
}
